<% excursions = subject_excursions(profile_or_current_subject, {:scope => scope, :limit => 0, :page=> page, :sort_by=> params[:sort_by]||sort_by||"popularity"}) %>

<% excursions.each do |excursion| %>
  <%= render :partial => 'excursions/excursion', :locals => { :excursion => excursion, :prefix_id => "profile" } %>
<% end %>

<script>
  <%if request.xhr?%>
    update_pageless_state("excursions", <%=excursions.num_pages%>, <%=excursions.current_page%>);
  <%else%>
    document.addEventListener("DOMContentLoaded", function(){  
      update_pageless_state("excursions", <%=excursions.num_pages%>, <%=excursions.current_page%>);
    });
  <%end%>
	
</script>
